<div class="row-fluid">
  <div class="span4">
  	 <select multiple="multiple" class="border tplbox" id="tpl_select">
  		<?php if( isset($tpls) && is_array($tpls) ): ?>
  		<?php foreach( $tpls as $item ): ?>
  			<option value="<?=$item['id']?>"><?=$item['title']?></option>
  		<?php endforeach; ?>	
  		<?php endif; ?>
	</select>
	<?php if( is_admin() ): ?>
	<div>
		<a href="javascript:check_list_tpl_remove($('#tpl_select option:selected').text());void(0);" class="pull-right"><i class="icon-close"></i> <?=__('PL_CHECK_LIST_TEMPLATE_REMOVE')?></a>
		<a href="javascript:check_list_tpl_create();void(0);"><i class="icon-plus"></i> <?=__('PL_CHECK_LIST_TEMPLATE_CREATE')?></a>
	</div>
	<?php endif; ?>
  </div>
  	<div class="span8">
  		<textarea class="border tplbox" id="tpl_text" name="tpl_text" <?php if( !is_admin() ): ?>readOnly="true"<?php else: ?> onkeypress="cktpll_changed();" <?php endif; ?> ></textarea>
  		<div>
  			<?php if( is_admin() ): ?><a href="javascript:check_list_tpl_update();void(0);" id="ckltpl_update_btn" class="pull-right btn"><?=__('PL_CHECK_LIST_TEMPLATE_UPDATE')?></a><?php endif; ?>
  			<a href="javascript:check_list_tpl_apply('<?=intval(v('todoid'))?>');void(0);" class="pull-right btn" id="ckltpl_apply_btn" ><?=__('PL_CHECK_LIST_TEMPLATE_APPLY')?></a> 
  		</div>	

	</div>
</div>
<script>
$('#tpl_select option').unbind('click');
$('#tpl_select option').bind('click',function()
{
	check_list_tpl_set2text($(this).attr('value'));
});


if( $('#tpl_select option').length > 0 )
{
	$('#tpl_select option:first').attr('selected',true);
	check_list_tpl_set2text($('#tpl_select option:selected').attr('value'));	
}



</script>